Fast detection of incorrect sampling in an oversampling clock and data recovery system

ABSTRACT

A method, in an oversampling clock and data recovery system, for detecting that sampling is stuck taking place at a data edge, by detecting a data edge in an early or a late region relative to a good region and incrementing a stuck early or stuck late counter; and if one counter reaching a maximum, setting a condition indicating that sampling is stuck taking place at a data edge. If a data edge is detected in the good region, or in each of an early and a late region in a single data period, the stuck counters are reset to zero. The detection of which stuck counter has reached a maximum can cause the moving of a sampling clock forward or backward, ending when a data edge occurs in a good region, or in each of an early region and a late region in a single data period.

FIELD OF THE INVENTION

[0001] The present invention relates to the field of clock and data recovery systems, and more particularly to the detection that a false lock is causing data sampling to be stuck taking place at a data edge rather than at a position central to the data.

BACKGROUND OF THE INVENTION

[0002] In an oversampling Clock and Data Recovery (CDR) system in which oversampling is more than twofold, two of the sampling clocks are positioned on each side of the average position of data edges in the serial input data by incrementing and decrementing the clock position to balance indications of late clocks and early clocks from the oversampling of the input stream. A lock is achieved when the clock position follows the average position of the data edge. The data is then preferably used from a sample made as centrally as possible between the noisy data edge positions. Two possible lock positions can be made. The CDR is “in lock” when the data is sampled centrally between the noisy data edge positions, but there is also an undesirable lock where the data sample is made in the middle of the noisy data edge position (a “false lock”).

[0003] Many phase-locked control loops exhibit both the desirable stable equilibrium position when the CDR is in lock and the unstable equilibrium condition, or false lock, when the CDR is 180° out of lock and is stuck sampling at the data edge. In this unstable equilibrium condition it can take a significant amount of time for the instability to grow sufficiently for the phase locked loop to move to the proper in lock condition.

[0004] Conventionally the system is allowed to settle into a lock using the same method used to follow the average data edge position. This can cause a false lock for an undesirably long time.

[0005] The conventional methods and apparatus of the prior art thus cannot prevent an oversampling clock and data recovery system from attaining such a false lock and settling into a position in which sampling is stuck for an extended period in a position in which it is taking place at a data edge.

SUMMARY OF THE INVENTION

[0006] The present invention accordingly provides, in a first aspect, a method, in an oversampling clock and data recovery system, for detecting that sampling is stuck taking place at a data edge, the method comprising the steps of: detecting a data edge in at least one of an early region and a late region relative to a good region; responsive to said step of detecting, incrementing at least one of a stuck early counter and a stuck late counter; and responsive to a first one of said stuck early counter and said stuck late counter reaching a maximum, setting a condition indicating that sampling is stuck taking place at a data edge.

[0007] The method of the first aspect preferably further comprises the steps of: detecting a data edge in said good region; and responsive to said step of detecting resetting said stuck early counter and said stuck late counter to zero.

[0008] The method of the first aspect preferably further comprises the steps of: detecting a data edge in each of said early region and said late region in a single data period; and responsive to said step of detecting resetting said stuck early counter and said stuck late counter to zero.

[0009] The method of the first aspect preferably further comprises the steps of: detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said step of detecting, moving a sampling clock in one of a forward and a backward direction; wherein said step of moving a sampling clock ends when a data edge occurs in said good region.

[0010] Preferably, said step of moving a sampling clock comprises moving by up to half a data period in a single movement.

[0011] The method of the first aspect preferably further comprises the steps of detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said step of detecting, moving a sampling clock in one of a forward and a backward direction; wherein said step of moving a sampling clock ends when a data edge occurs in each of said early region and said late region in a single data period.

[0012] Preferably said step of moving a sampling clock comprises moving by up to half a data period in a single movement.

[0013] The method of the first aspect preferably further comprises the steps of: prior to said step of setting a condition, determining that at least one signal has been detected in each of said early region and said late region.

[0014] In a second aspect, the invention provides a computer program product comprising computer readable code tangibly embodied in a computer readable medium to, when loaded into a computer system and executed, cause said computer system to carry out all the steps of a method, in an oversampling clock and data recovery system, for detecting that sampling is stuck taking place at a data edge, the computer program product comprising program code means for: detecting a data edge in at least one of an early region and a late region relative to a good region; responsive to said means for detecting, incrementing at least one of a stuck early counter and a stuck late counter; and responsive to a first one of said stuck early counter and said stuck late counter reaching a maximum, setting a condition indicating that sampling is stuck taking place at a data edge.

[0015] The computer program product of the second aspect preferably further comprises program code means for: detecting a data edge in said good region; and responsive to said program code means for detecting an edge in said good region, resetting said stuck early counter and said stuck late counter to zero.

[0016] The computer program product of the second aspect preferably further comprises program code means for: detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said program code means for detecting, moving a sampling clock in one of a forward and a backward direction; wherein said program code means for moving a sampling clock ends its operation when a data edge occurs in said good region.

[0017] Preferably said program code means for moving a sampling clock comprises program code means for moving by up to half a data period in a single movement.

[0018] The computer program product of the second aspect preferably further comprises program code means for: detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said program code means for detecting, moving a sampling clock in one of a forward and a backward direction; wherein said program code means for moving a sampling clock ends its operation when a data edge occurs in each of said early region and said late region in a single data period.

[0019] Preferably, said program code means for moving a sampling clock comprises program code means for moving by up to half a data period in a single movement.

[0020] The computer program product of the second aspect preferably further comprises program code means, operable prior to said program code means for setting a condition indicating that sampling is stuck taking place at a data edge, for: determining that at least one signal has been detected in each of said early region and said late region.

[0021] In a third aspect, the invention provides a detector apparatus for detecting that sampling is stuck taking pace at a data edge in an oversampling clock and data recovery system, comprising: means for detecting a data edge in at least one of an early region and a late region relative to a good region; means, responsive to said means for detecting, for incrementing at least one of a stuck early counter and a stuck late counter; and means, responsive to a first one of said stuck early counter and said stuck late counter reaching a maximum, for setting a condition indicating that sampling is stuck taking place at a data edge.

[0022] The detector apparatus of the third aspect preferably further comprises: means for detecting a data edge in said good region; and means, responsive to said means for detecting an edge in said good region, for resetting said stuck early counter and said stuck late counter to zero.

[0023] The detector apparatus of the third aspect preferably further comprises: means for detecting which of said stuck early counter and said stuck late counter has reached a maximum; and means, responsive to said means for detecting, for moving a sampling clock in one of a forward and a backward direction; wherein said means for moving a sampling clock ends said moving when a data edge occurs in a good region.

[0024] Preferably, said means for moving a sampling clock comprises means for moving by up to half a data period in a single movement.

[0025] The detector apparatus of the third aspect preferably further comprises: means for detecting which of said stuck early counter and said stuck late counter has reached a maximum; and means, responsive to said means for detecting, for moving a sampling clock in one of a forward and a backward direction; wherein said means for moving a sampling clock ends said moving when a data edge occurs in each of said early region and said late region in a single data period.

[0026] Preferably, said means for moving a sampling clock comprises means for moving by up to half a data period in a single movement.

[0027] The detector apparatus of the third aspect preferably further comprises: means, operable prior to said means for setting a condition indicating that sampling is stuck taking place at a data edge, for determining that at least one signal has been detected in each of said early region and said late region.

[0028] The preferred embodiments of the invention most suitably and advantageously detect a false lock by looking for a preponderance of early and late edges, when relatively few good edges are found. Preferably, digital counters are used to trigger thresholds.

[0029] Some applications of serial data receivers require lock times within 200 data bit times or less; the serial data stream may be switched from one source to another, creating a possible step in the average edge position.

[0030] The method of a preferred embodiment of the present invention can detect a false lock, where sampling is stuck taking place at a data edge, without any prior indication that such a condition may be encountered. The method also speeds up normal locking by detecting conditions near a false lock, then moving a sampling clock to a condition near an in lock condition.

[0031] The solution provided by the preferred embodiment of the present invention can detect when a false lock occurs by checking the position of the edges, and can then adjust the sampling position by moving a sampling clock, in the correct direction, to a position where the normal method can reliably attain lock, and thus begin sampling at a position central to the data.

BRIEF DESCRIPTION OF THE DRAWINGS

[0032] A preferred embodiment of the present invention will now be described, by way of example only, with reference to the accompanying drawings, in which:

[0033]FIG. 1 shows a latch arrangement of a preferred embodiment of the present invention relative to a flow of data for the threefold oversampling case.

[0034]FIG. 2a shows a pseudo-code representation of a first portion of a method according to a preferred embodiment of the present invention.

[0035]FIG. 2b shows a pseudo-code representation of a second portion of a method according to a preferred embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

[0036] Under an in lock condition the data edges will be largely between two sample positions. This is the “good” region. The region between the data sample position and the following edge sample position is known as “late” because the clock may be late if a data edge occurs in this region. The region between the data sample position and the previous edge sample is known as “early” because the clock may be early if a data edge occurs in this region. During an in lock condition there will be some data edges in Early and Late but most data edges will be in the “Good” region. During a false lock most data edges will be in the Early/Late positions with very few in the good region and the data will be being sampled at a data edge rather than a position central to the data. The method of a preferred embodiment of the present invention detects a false lock by looking for a series of edges in the Early/Late regions. In a most preferred embodiment a false lock is detected if there are a set number of consecutive Early/Late signals, with at least one signal being detected in each of Early and Late. This second condition is to stop a false lock being wrongly detected due to conditions such as large Sinusoidal Jitter, which may cause runs of edges in just the Early or just the Late region. The set number of consecutive Early/Late signals may be varied according to the type of data, the characteristics required of the detector, the type of noise expected in the system and the like, as will be clear to one skilled in the art. Preferably, the number will be set such that the probability of detecting an apparent false lock when there is none is suitably small.

[0037] Referring now to FIG. 1, m is the data sample that should occur in the middle of the data “middle sample” when in lock; eb is the data sample that should occur near the data edge before the middle sample when in lock; and ea is the data sample that should occur near the data edge after the middle sample when in lock. By placing an XOR gate between each successive pair of data samples, a signal is generated that will be high if the clock is early, a signal high if the clock is late and a signal high if the clock position is good.

[0038] Turning to FIG. 2a, pseudo-code is shown which, for each of three data samples, tests at steps 1, 2 and 3 for conditions EARLY, LATE OR GOOD.

[0039] Continuing at FIG. 2b, pseudo-code is shown which continues the sequence by testing at step 4 for an EARLY condition when either STUCK is false or the STUCK_EARLY_COUNT is zero and responding by incrementing the STUCK_EARLY_COUNT. Step 5 tests and responds in the equivalent way for a LATE condition.

[0040] At step 6, a GOOD condition causes both counters to be reset to zero. Steps 7 and 8 test for either of the STUCK_EARLY and STUCK_LATE counters reaching a maximum value, and responding by setting the appropriate condition. Step 9 tests for either of the stuck (EARLY or LATE) conditions and sets a STUCK flag.

[0041] Step 10 consists of a series of tests and comparisons to determine whether the sampling clock should be moved or not, and, if it should be moved, determining whether it should be moved by a large or small amount and in which direction. The tests are for the STUCK_EARLY and STUCK_LATE conditions, to determine if the sampling clock should be moved to a significantly later or earlier position. The comparisons are carried out between the counters to determine if a smaller movement of the sampling clock to an earlier or later position is indicated. If sampling is to be moved to a significantly earlier or later position, the clock position can be moved by up to half a data period.

[0042] A CDR according to the prior art can become stuck sampling at the data edge because there are not significantly more early clock or late clock indications often enough to move it towards lock and when the sampling clock is moved it can be moved in the wrong direction.

[0043] When the CDR is locked most of the data edges will occur in between the edge samples (the good region) with some edges occurring between the middle sample and the previous edge sample (the early region) and some edges occurring in between the middle sample and the next edge sample (the late region). The STUCK_EARLY_COUNT and STUCK_LATE_COUNT will not get very large because they are frequently reset when there is an edge in the good region or if there has been a narrow data pulse with an edge in the early region at the same time as an edge in the late region. However if there is a component of timing jitter between the data and clock that is high enough in frequency that the CDR should not follow it then the majority of data edges could move out of the good region and into the early region on the peak of the jitter, and then back through the good region and into the late region on the trough of the jitter. There will be very few transitions in the late region when high frequency jitter is causing the majority of transitions to be in the early region (unless it is so large that the CDR phase locked loop could not cope with it anyway). So STUCK will not be detected if STUCK_EARLY_COUNT reaches the limit and STUCK_LATE_COUNT is still zero. Similarly STUCK will not be detected if STUCK_LATE_COUNT reaches the limit and STUCK_EARLY_COUNT is still zero. This will stop high frequency timing jitter from causing false detection.

[0044] The STUCK_COUNT_LIMIT is set such that the probability of detecting “stuck” when the loop is correctly locked is sufficiently low.

[0045] When the CDR is stuck sampling at the data edge there will be many edges occurring in the early and late region and very few in the good region so that the stuck counters will quickly leave zero and one will reach the limit without being reset. Medium frequency timing jitter can cause periods of time with more transition in the good region but it will also make the CDR less likely to get stuck. An offset between the sampling clock period and the data clock period will also tend to stop the CDR from getting stuck.

[0046] The system of the preferred embodiment can be easily modified so that it works with 6 samples over 2 data bit periods or 12 samples over 4 data bits etc., so that the logic can operate at a clock frequency which is less that the received data rate.

[0047] In a most preferred embodiment, if either counter reaches its maximum while the other counter is not zero then an incorrect lock has been detected, indicating that sampling is stuck taking place at the edge of the data. The sampling clock may then most suitably be moved in a direction determined by the identification of the counter that has reached its maximum. If both counters reach the maximum then it does not matter in which direction the sampling clock is moved.

[0048] Embodiments of the present invention may be embodied as hardware logic in a circuit, or alternatively it may be embodied in a hardware description language.

[0049] Alternatively, the present invention may be embodied as a software computer program product for use with a computer system. Such an implementation may comprise a series of computer readable instructions either fixed on a tangible medium, such as a computer readable medium, e.g., diskette, CD-ROM, ROM, or hard disk, or transmittable to a computer system, via a modem or other interface device, over either a tangible medium, including but not limited to optical or analogue communications lines, or intangibly using wireless techniques, including but not limited to microwave, infrared or other transmission techniques. The series of computer readable instructions embodies all or part of the functionality previously described herein

[0050] Those skilled in the art will appreciate that such computer readable instructions can be written in a number of programming languages for use with many computer architectures or operating systems. Further, such instructions may be stored using any memory technology, present or future, including but not limited to, semiconductor, magnetic, or optical, or transmitted using any communications technology, present or future, including but not limited to optical, infrared, or microwave. It is contemplated that such a computer program product may be distributed as a removable medium with accompanying printed or electronic documentation, e.g., shrink wrapped software, pre-loaded with a computer system, e.g., on a system ROM or fixed disk, or distributed from a server or electronic bulletin board over a network, e.g., the Internet or World Wide Web.

[0051] Thus, the preferred embodiments of the present invention advantageously provide a way to achieve an in lock condition in an oversampling clock and data recovery system by detecting a predominance of data edges in the early and late regions with relatively few data edges in the good region. The preferred embodiments further advantageously avoid incorrect detection of an apparent false lock condition when none exists. 

What is claimed is:
 1. A method, in an oversampling clock and data recovery system, for detecting that sampling is stuck taking place at a data edge, the method comprising the steps of: detecting a data edge in at least one of an early region and a late region relative to a good region; responsive to said step of detecting, incrementing at least one of a stuck early counter and a stuck late counter; and responsive to a first one of said stuck early counter and said stuck late counter reaching a maximum, setting a condition indicating that sampling is stuck taking place at a data edge.
 2. The method of claim 1, further comprising the steps of: detecting a data edge in said good region; and responsive to said step of detecting resetting said stuck early counter and said stuck late counter to zero.
 3. The method of claim 1, further comprising the steps of: detecting a data edge in each of said early region and said late region in a single data period; and responsive to said step of detecting resetting said stuck early counter and said stuck late counter to zero.
 4. The method of claim 1, further comprising the steps of: detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said step of detecting, moving a sampling clock in one of a forward and a backward direction; wherein said step of moving a sampling clock ends when a data edge occurs in said good region.
 5. The method of claim 4, wherein said step of moving a sampling clock comprises moving by up to half a data period in a single movement.
 6. The method of claim 1, further comprising the steps of: detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said step of detecting, moving a sampling clock in one of a forward and a backward direction; wherein said step of moving a sampling clock ends when a data edge occurs in each of said early region and said late region in a single data period.
 7. The method of claim 6, wherein said step of moving a sampling clock comprises moving by up to half a data period in a single movement.
 8. The method of claim 1, further comprising the step of: prior to said step of setting a condition, determining that at least one signal has been detected in each of said early region and said late region.
 9. A computer program product comprising computer readable code embodied in a computer readable medium to, when loaded into a computer system and executed, cause said computer system to carry out all the steps of a method, in an oversampling clock and data recovery system, for detecting that sampling is stuck taking place at a data edge, the computer program product comprising program code means for: detecting a data edge in at least one of an early region and a late region relative to a good region; responsive to said means for detecting, incrementing at least one of a stuck early counter and a stuck late counter; and responsive to a first one of said stuck early counter and said stuck late counter reaching a maximum, setting a condition indicating that sampling is stuck taking place at a data edge.
 10. The computer program product of claim 9, further comprising program code means for: detecting a data edge in said good region; and responsive to said program code means for detecting an edge in said good region, resetting said stuck early counter and said stuck late counter to zero.
 11. The computer program product of claim 9, further comprising program code means for: detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said program code means for detecting, moving a sampling clock in one of a forward and a backward direction; wherein said program codemeans for moving a sampling clock ends its operation when a data edge occurs in said good region.
 12. The computer program product of claim 11, wherein said program code means for moving a sampling clock comprises program code means for moving by up to half a data period in a single movement.
 13. The computer program product of claim 9, further comprising program code means for: detecting which of said stuck early counter and said stuck late counter has reached a maximum; and responsive to said program code means for detecting, moving a sampling clock in one of a forward and a backward direction; wherein said program code means for moving a sampling clock ends its operation when a data edge occurs in each of said early region and said late region in a single data period.
 14. The computer program product of claim 13, wherein said program code means for moving a sampling clock comprises program code means for moving by up to half a data period in a single movement.
 15. The computer program product of claim 9, further comprising program code means, operable prior to said program code means for setting a condition indicating that sampling is stuck taking place at a data edge, for: determining that at least one signal has been detected in each of said early region and said late region.
 16. A detector apparatus for detecting that sampling is stuck taking pace at a data edge in an oversampling clock and data recovery system, comprising: means for detecting a data edge in at least one of an early region and a late region relative to a good region; means, responsive to said means for detecting, for incrementing at least one of a stuck early counter and a stuck late counter; and means, responsive to a first one of said stuck early counter and said stuck late counter reaching a maximum, for setting a condition indicating that sampling is stuck taking place at a data edge.
 17. The detector apparatus of claim 16, further comprising: means for detecting a data edge in said good region; and means, responsive to said means for detecting an edge in said good region, for resetting said stuck early counter and said stuck late counter to zero.
 18. The detector apparatus of claim 16, further comprising: means for detecting which of said stuck early counter and said stuck late counter has reached a maximum; and means, responsive to said means for detecting, for moving a sampling clock in one of a forward and a backward direction; wherein said means for moving a sampling clock ends said moving when a data edge occurs in a good region.
 19. The detector apparatus of claim 18, wherein said means for moving a sampling clock comprises means for moving by up to half a data period in a single movement.
 20. The detector apparatus of claim 16, further comprising: means for detecting which of said stuck early counter and said stuck late counter has reached a maximum; and means, responsive to said means for detecting, for moving a sampling clock in one of a forward and a backward direction; wherein said means for moving a sampling clock ends said moving when a data edge occurs in each of said early region and said late region in a single data period.
 21. The detector apparatus of claim 20, wherein said means for moving a sampling clock comprises means for moving by up to half a data period in a single movement.
 22. The detector apparatus of claim 16, further comprising: means, operable prior to said means for setting a condition indicating that sampling is stuck taking place at a data edge, for determining that at least one signal has been detected in each of said early region and said late region. 